{include file="common/head"}
<div class="headerImages">
    <div class="swiper-container">
        <div class="swiper-wrapper">
            {volist name="lunbo" id="vo"}
            <div class="swiper-slide">
                <img src="{$vo.image}" alt="图片丢失" />
            </div>
            {/volist}
        </div>
        <div class="swiper-pagination"></div>
    </div>
</div>
<section class="sectionOverind3">
    <div class="leavingMessage-title">留言给我们</div>
    <div class="leavingMessage-cent">
        <div>
            <div class="leavingMessage-cent-top">
                <div>
                    姓名
                </div>
                <span>*</span>
                <p>:</p>
            </div>
            <input type="text" class="userName" />
        </div>
        <div>
            <div class="leavingMessage-cent-top">
                <div>
                    电话
                </div>
                <span>*</span>
                <p>:</p>
            </div>
            <input type="text" class="userPhone" />
        </div>
        <div>
            <div class="leavingMessage-cent-top">
                <div>
                    微信
                </div>
                <p>:</p>
            </div>
            <input type="text" class="userWchat"/>
        </div>
        <div>
            <div class="leavingMessage-cent-top">
                <div>
                    邮箱
                </div>
                <p>:</p>
            </div>
            <input type="text" class="userEmaile" />
        </div>
        <div>
            <div class="leavingMessage-cent-top">
                <div>
                    内容
                </div>
                <p>:</p>
            </div>
            <textarea style="resize:none;" class="userCent"></textarea>
        </div>
        <div class="submitButoon">
            提交
        </div>
    </div>
</section>
{include file="common/foot"}
<script>
    $(".submitButoon").click(function(){
        var userName=$(".userName").val();
        var userPhone=$(".userPhone").val();
        var wechat=$(".userWchat").val();
        var email=$(".userEmaile").val();
        var content=$(".userCent").val();
        if(userName==""||userName==null){
            alert("姓名不能为空!");
            return false;
        }
        if(userPhone==""||userPhone==null){
            alert("电话不能为空!");
            return false;
        }else if(userPhone.length != 11){
            alert("手机号格式不正确!");
            return false;
        }
        $.ajax({
            type:"post",
            url:" /mobile/massage/massage",
            async:true,
            data:{
                "username":userName,
                "telephone":userPhone,
                "wechat":wechat,
                "email":email,
                "content":content
            },
            success:function(data){
                console.log("data",data);
                if(data.code==0){
                    alert(data.msg);
                }else{
                    alert("提交成功!");
                    window.location.href="/";
                }
            },
            error:function(){
                alert("提交错误!");
            }
        });
    });
</script>